package com.woniuxy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.Arrays;

import java.util.List;


@Controller
public class LoginController {
    @RequestMapping("/login")
    public ModelAndView login(String username, @RequestParam("pass") String password, int money){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("username",username);
        modelAndView.addObject("money",money);
        modelAndView.addObject("password",password);
        modelAndView.setViewName("/WEB-INF/jsp/success.jsp");
        return modelAndView;
    }
    @RequestMapping("passarray")
    public ModelAndView passArray(String username,String[] hobby){
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("username",username);
        modelAndView.addObject("msg", Arrays.toString(hobby));
        modelAndView.setViewName("/WEB-INF/jsp/showHobby.jsp");
        return modelAndView;
    }


}
